package io.codegeneratetool.util.validate;

import java.lang.reflect.Field;
import java.util.Map;
 
import org.hibernate.validator.constraints.NotEmpty;

public class NotEmptyProcessor extends BaseProcessorChain<NotEmpty>{

	public <T> void process(T t, Field field,
			Map<String, Object> validateContainer, Map<String, Object> messages) {
		
		validateContainer.put("required", true);
		NotEmpty ne = field.getAnnotation(NotEmpty.class);
		if(ne!=null){
			String message = ne.message();
			if(io.codegeneratetool.util.StringUtils.isNullOrEmpty(message)){
				messages.put("required", "不能为空");
			}else{
				messages.put("required",message);
			}
		}
		
		
	}

}
